home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / winsock / wschesb1.zip / SRC / REVIEW.C < prev    next >
C/C++ Source or Header  |  1994-03-15  |  4KB  |  125 lines

  1. /*
  2.   C source for Winsock Chess
  3.   
  4.   Revision 1994-03-15
  5.   Modified by Donald Munro for use as a 2 player chess game over a 
  6.   WINSOCK layer on a TCP (or other WinSock supporting) network.
  7.   Source code and make files for MS Visual C/C++ V1.00/1.50.
  8.   February/March 1994
  9.   All GNU copyright and distribution conditions as described below and in the
  10.   file COPYING also apply to WinSock Chess.
  11.   This module is adapted from GNU Chess.
  12.  
  13.   C source for GNU CHESS
  14.  
  15.   Revision: 1990-09-30
  16.  
  17.   Modified by Daryl Baker for use in MS WINDOWS environment
  18.  
  19.   This file is part of CHESS.
  20.  
  21.   CHESS is distributed in the hope that it will be useful, but WITHOUT ANY
  22.   WARRANTY.  No author or distributor accepts responsibility to anyone for
  23.   the consequences of using it or for whether it serves any particular
  24.   purpose or works at all, unless he says so in writing.  Refer to the CHESS
  25.   General Public License for full details.
  26.  
  27.   Everyone is granted permission to copy, modify and redistribute CHESS, but
  28.   only under the conditions described in the CHESS General Public License.
  29.   A copy of this license is supposed to have been given to you along with
  30.   CHESS so you can know your rights and responsibilities.  It should be in a
  31.   file named COPYING.  Among other things, the copyright notice and this
  32.   notice must be preserved on all copies.
  33. */
  34.  
  35. #define NOATOM 
  36. #define NOCLIPBOARD
  37. #define NOCREATESTRUCT
  38. #define NOFONT
  39. #define NOREGION
  40. #define NOSOUND
  41. #define NOWH
  42. #define NOWINOFFSETS
  43. #define NOCOMM
  44. #define NOKANJI
  45.  
  46. #include <windows.h>
  47. #include "gnuchess.h"
  48. #include "defs.h"
  49. #include "chess.h"
  50.  
  51. extern char mvstr[4][6];
  52.  
  53. BOOL FAR PASCAL ReviewDlgProc ( HWND hDlg, unsigned message,
  54.                                WORD wParam, LONG lParam);
  55.  
  56.  
  57. int ReviewDialog ( HWND hWnd, HANDLE hInst)
  58. {
  59.    FARPROC lpProcReview;
  60.    int status;
  61.  
  62.    lpProcReview = MakeProcInstance(ReviewDlgProc, hInst);
  63.     status = DialogBoxParam (hInst, MAKEINTRESOURCE(REVIEW),   hWnd,  lpProcReview, 0);
  64.    FreeProcInstance(lpProcReview);
  65.    return status;
  66. }
  67.  
  68. BOOL FAR PASCAL ReviewDlgProc ( HWND hDlg, unsigned message,
  69.                                WORD wParam, LONG lParam)
  70. {
  71.  
  72.    int i,f,t;
  73.    char tmp[50];
  74.  
  75.    switch (message) {
  76.        case WM_INITDIALOG:         /* message: initialize dialog box */
  77.  
  78.         for (i = 1; i <= GameCnt; i++) {
  79.             f = GameList[i].gmove >> 8;
  80.             t = (GameList[i].gmove & 0xFF);
  81.             algbr (f, t, false);
  82.             wsprintf (tmp, "%4d\t\t%5s\t\t",
  83.                (i+1)/2, 
  84.                (char far *)mvstr[0]);
  85.              i++;
  86.              if ( i > GameCnt) 
  87.                { SendDlgItemMessage (hDlg, 100, LB_ADDSTRING, 0, 
  88.                                      (LPARAM) ((char FAR *)tmp));
  89.                  break;  
  90.                }  
  91.              f = GameList[i].gmove >> 8;
  92.              t = (GameList[i].gmove & 0xFF);  
  93.              algbr (f, t, false);
  94.              lstrcat(tmp,mvstr[0]);
  95.              SendDlgItemMessage (hDlg, 100, LB_ADDSTRING, 0, 
  96.                                  (LPARAM) ((char FAR *)tmp));
  97.          }
  98.          SendDlgItemMessage (hDlg, 100, WM_SETREDRAW, TRUE, 0);
  99.          return (TRUE);
  100.  
  101.       case WM_SYSCOMMAND:
  102.          if ( (wParam&0xfff0) == SC_CLOSE ) {
  103.               EndDialog(hDlg, NULL);
  104.               return TRUE;
  105.          }
  106.          break;
  107.  
  108.  
  109.        case WM_COMMAND:           /* message: received a command */
  110.          switch (wParam) {
  111.          
  112.             case IDOK:
  113.                  EndDialog(hDlg, 1);
  114.                  return TRUE;
  115.                break;
  116.  
  117.          }
  118.           break;
  119.     }
  120.  
  121.     return (FALSE);               /* Didn't process a message    */
  122. }
  123.  
  124.  
  125.